package com.qs.education.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.qs.education.bean.api.ResponseListBean;
import com.qs.education.bean.entity.EducationSubjectUnit;
import com.qs.education.service.ISubjectUnitAPPService;

/**
 * @class EducationSubjectUnitController
 * @author Leon
 * @description
 * @date Nov 20, 2018
 */
@RequestMapping("/subjectUnit")
@RestController
public class EducationSubjectUnitController {
	
	@Autowired
	private ISubjectUnitAPPService subjectUnitAppService;
	
	private final Logger log = Logger.getLogger(this.getClass());
	
	/**
	 * @Description 根据年级和学科 查询单元和课时
	 * @author Leon
	 * @date   Nov 20, 2018
	 * @param  
	 * @return EducationSubjectUnit
	 */
	@RequestMapping("/findUnitAndLessonByGradeIdAndSubjectId")
	public ResponseListBean<EducationSubjectUnit> findUnitAndLesson(@RequestBody EducationSubjectUnit subjectUnit) {
		log.info("app controller subjectUnit findUnitAndLesson");
		System.out.println(subjectUnit.getGrade().getId());
		System.out.println(subjectUnit.getSubject().getId());
		ResponseListBean<EducationSubjectUnit> unitList = new ResponseListBean<EducationSubjectUnit>();
		unitList = subjectUnitAppService.findUnitAndLesson(subjectUnit);
		return unitList;
	}
}
